/****************************************************************************
*
*					Functions of class StructureLearningFactory
*
****************************************************************************/

#include "StructureLearningFactory.h"
#include "AllStructureLearningClasses.h"


/****************************************************************************
*					StructureLearningFactory::StructureLearningFactory
*
*	Description:	Standard constructor with initialization of internal parameters
*	Parameters:		-
*	Returns:		-
*
****************************************************************************/
StructureLearningFactory::StructureLearningFactory (void) {
	
}


/****************************************************************************
*					StructureLearningFactory::~StructureLearningFactory
*
*	Description:	Standard destructor with removing all dynamic internal variables
*	Parameters:		-
*	Returns:		-
*
****************************************************************************/
StructureLearningFactory::~StructureLearningFactory (void) {
	
}


/****************************************************************************
*					StructureLearningFactory::createObjectByID
*
*	Description:	Function creates object of ancestor class StructureLearning
*					of a subclass with a given ID
*	Parameters:		id - identificator of subclass of class StructureLearning
*	Returns:		StructureLearning* - new dynamic object of subclass of 
*						StructureLearning with the given ID
*
****************************************************************************/
StructureLearning* StructureLearningFactory::createObjectByID(const signed int id) {
	// Dummy
	return NULL;
}


/****************************************************************************
*					StructureLearningFactory::createObjectByName
*
*	Description:	Function creates object of ancestor class StructureLearning
*					of a subclass with a given name
*	Parameters:		name - name of the desired subclass of class StructureLearning
*	Returns:		StructureLearning* - new dynamic object of subclass of 
*						StructureLearning with the given name
*
****************************************************************************/
StructureLearning* StructureLearningFactory::createObjectByName(const std::string name) {
	// Transforming to lowercase
	std::string nameStr (name);
	std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower);
	
	// Comparing the names
	if (strcmp (nameStr.c_str(), "improvedgreedy") == 0) {
		return new ImprovedGreedyAlgorithm();
	}
	if (strcmp (nameStr.c_str(), "greedy") == 0) {
		return new GreedyAlgorithm();
	}

	// Returning the NULL value
	StructureLearning* slClass = NULL;
	return slClass;
}
